#include<stdio.h>
#include<math.h>

int main(void)
{
	int sign=1;
	double pi=0.0,n=1,term=1.0;
	
	while (fabs(term)>=1e-9)
	{
		pi+=term;
		n+=2;
		sign=-sign;
		term=sign/n;
	}
	pi*=4;
	printf("pi=%lf", pi);
	
	return 0;
}
